package jun.learn.thread.queue;

import java.util.concurrent.BlockingQueue;

public class Consumer implements Runnable{
	
	private BlockingQueue<String> queue;
	
	public Consumer(BlockingQueue<String> queue) {
		super();
		this.queue = queue;
	}

	public void run() {
		while(true){
			try {
				String value = queue.take();
				System.out.println(Thread.currentThread().getName()+"  Consumer consum a value:"+value);
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
